home *** CD-ROM | disk | FTP | other *** search
/ Treccani Italiana Di Scienze Lettere Ed Arti / [Enciclopedia] Treccani Italiana di scienze lettere ed arti.iso / pc / data / xxi_appendice_dvd.swf / scripts / __Packages / CDialogManager.as < prev    next >
Text File  |  2007-11-08  |  3KB  |  125 lines

  1. class CDialogManager extends mx.core.UIObject
  2. {
  3.    var mLoading = false;
  4.    function CDialogManager()
  5.    {
  6.       super();
  7.       this._visible = false;
  8.       this.init();
  9.    }
  10.    function init()
  11.    {
  12.       this.mEnableGrab = true;
  13.       this.mStartX = 40;
  14.       this.mStartY = 205;
  15.       this.mX = this._x;
  16.       this.mY = this._y;
  17.       this.mFile = "";
  18.       this.mFrame = "";
  19.       this.mLoading = false;
  20.       this.mc_ProgressBar._visible = false;
  21.       this.createEmptyMovieClip("content",3);
  22.       this.content._x = this.mStartX;
  23.       this.content._y = this.mStartY;
  24.       this.Show(false);
  25.       this.content.onPress = function()
  26.       {
  27.       };
  28.       this.content.useHandCursor = false;
  29.       this.mc_DialogGrabR.onPress = mx.utils.Delegate.create(this,this.onGrabClick);
  30.    }
  31.    function onGrabClick()
  32.    {
  33.       this.Show(false);
  34.    }
  35.    function LoadContents(inFile, inMarker, inModal)
  36.    {
  37.       this.Show(true,inModal);
  38.       if(inFile != this.mFile)
  39.       {
  40.          if(this.mFile != "")
  41.          {
  42.             this.content.unloadMovie();
  43.          }
  44.          this.mFile = inFile;
  45.          this.mFrame = inMarker;
  46.          this.mLoading = true;
  47.          this.mc_ProgressBar._visible = true;
  48.          this.content.loadMovie(this.mFile);
  49.       }
  50.       else
  51.       {
  52.          this.mFrame = inMarker;
  53.          if(!this.mLoading)
  54.          {
  55.             this.JumpToMarker();
  56.          }
  57.       }
  58.    }
  59.    function GoMarker(inMarker)
  60.    {
  61.       if(this.mFile != "")
  62.       {
  63.          this.content.gotoAndStop(inMarker);
  64.       }
  65.    }
  66.    function onEnterFrame(inValue)
  67.    {
  68.       if(this.mLoading)
  69.       {
  70.          var _loc3_ = this.content.getBytesLoaded();
  71.          var _loc2_ = this.content.getBytesTotal();
  72.          var _loc4_ = Math.min(_loc3_ / _loc2_ * 100,100);
  73.          this.mc_ProgressBar.SetProgress(_loc4_);
  74.          if(_loc3_ >= _loc2_ && _loc2_ != 0)
  75.          {
  76.             this.mc_ProgressBar.SetProgress(100);
  77.             this.mc_ProgressBar._visible = false;
  78.             this.mLoading = false;
  79.             if(this.mFrame != "")
  80.             {
  81.                this.JumpToMarker();
  82.                this.doLater(this,"JumpToMarker");
  83.             }
  84.          }
  85.       }
  86.    }
  87.    function JumpToMarker()
  88.    {
  89.       if(this.mFrame == "")
  90.       {
  91.          return undefined;
  92.       }
  93.       if(this.content.VaiA)
  94.       {
  95.          this.content.VaiA(this.mFrame);
  96.       }
  97.       else
  98.       {
  99.          this.content.gotoAndStop(this.mFrame);
  100.       }
  101.    }
  102.    function Show(inTrueFalse, inModal)
  103.    {
  104.       if(inModal == undefined)
  105.       {
  106.          inModal = true;
  107.       }
  108.       if(inTrueFalse != this.content._visible)
  109.       {
  110.          this.content._visible = inTrueFalse;
  111.       }
  112.       if(inTrueFalse)
  113.       {
  114.          this.content._x = this.mStartX;
  115.          this.content._y = this.mStartY;
  116.       }
  117.       this.mc_DialogGrabR._visible = inModal && inTrueFalse;
  118.       this._visible = inTrueFalse;
  119.    }
  120.    function onUnload()
  121.    {
  122.       this.content.removeMovieClip();
  123.    }
  124. }
  125.